package com.atguigu.gmall.product.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lfy
 * @Description
 * @create 2023-07-12 9:20
 */
@Configuration
public class AppMybatisConfiguration {


    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        //1、创建一个MyBatis拦截器
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();

        //2、每一种功能插件都是内部的一个拦截器
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
